package defaultPackage;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.process.ProcessInstance;
import org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler;
import org.jbpm.task.TaskService;
import org.jbpm.task.query.TaskSummary;
import org.jbpm.test.JbpmJUnitTestCase;
import org.junit.Test;

public class DifusionJUnitTest extends JbpmJUnitTestCase {

    public DifusionJUnitTest() {
        super(true);
    }

	@Test
    public void test2() {
        StatefulKnowledgeSession ksession = createKnowledgeSession("sample.bpmn");
        TaskService taskService = getTaskService(ksession);
        Map<String, Object> params = new HashMap<String, Object>();
        // initialize variables here if necessary
        // params.put("validaA", value); // type Boolean
        // params.put("validaB", value); // type Boolean
        // params.put("validaC", value); // type Boolean
        ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello", params);
        // execute task
        String actorId = "john";
        List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner(actorId, new ArrayList<String>(), "en-UK");
        TaskSummary task = list.get(0);
        taskService.start(task.getId(), actorId);
        Map<String, Object> results = new HashMap<String, Object>();
        // add results here
        taskService.completeWithResults(task.getId(), actorId, results);

        // execute task
        String actorId1 = "john";
        List<TaskSummary> list1 = taskService.getTasksAssignedAsPotentialOwner(actorId, new ArrayList<String>(), "en-UK");
        TaskSummary task1 = list.get(0);
        taskService.start(task.getId(), actorId);
        Map<String, Object> results1 = new HashMap<String, Object>();
        // add results here
        taskService.completeWithResults(task.getId(), actorId, results);

        // do your checks here
        // for example, assertProcessInstanceCompleted(processInstance.getId(), ksession);
    }
}